//
//  AffirmForgetPwdVC.m
//  WalletAPP
//
//  Created by 罗弟祥 on 2019/10/12.
//  Copyright © 2019 罗弟祥. All rights reserved.
//

#import "AffirmForgetPwdVC.h"

@interface AffirmForgetPwdVC ()
@property (weak, nonatomic) IBOutlet UITextField *NewPwdTF;
@property (weak, nonatomic) IBOutlet UITextField *reNewPwdTF;
@property (weak, nonatomic) IBOutlet UIButton *nextBtn;

@property (nonatomic, retain) RefreshVM *vm;
@end

@implementation AffirmForgetPwdVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)backBtnClick:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)nextBtnClick:(UIButton *)sender {
    if (self.NewPwdTF.text.length < 1) {
        [SVProgressHUD showErrorWithStatus:@"请输入新密码"];
        return;
    }
    if (self.reNewPwdTF.text.length < 1) {
       [SVProgressHUD showErrorWithStatus:@"请输入再次输入新密码"];
        return;
    }
    [self changePasswordRequest];
}

-(void)changePasswordRequest{
    self.vm = [RefreshVM new];
    self.vm.urlStr = @"api/password/reset";
    self.vm.params = @{
        @"account":self.email,
        @"password":self.NewPwdTF.text,
        @"password_confirmation":self.reNewPwdTF.text,
        @"code":self.code
        };
    
    [self.vm requestDataNormal];
    [self.vm setRequestResultBlock:^(id obj) {
        
        [self.navigationController popToRootViewControllerAnimated:YES];
    
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
